
#import <UIKit/UIKit.h>

#import "Common.h"

@class Renderer;

typedef struct 
{
	float	left,right;
	float	top,bottom;
	float	zNear,zFar;
} Frustum;

typedef enum
{
	ProjectionPerspective=0,
	ProjectionOrtho,
} ProjectionEnum;

@interface Camera : NSObject
{
	ProjectionEnum	projection;
	
	float			fov;
	Frustum			frustum;
	
	Vector3			pos;
	Vector3			rightVector,forwardVector,upVector;
	Vector3			globalUpVector;

	CGRect			viewPort;

	Renderer		*renderer;
}

@property (assign)		ProjectionEnum	projection;

@property (assign)		float		fov;
@property (readonly)	Frustum		frustum;

@property (assign)		Vector3		pos;
@property (readonly)	Vector3		rightVector,forwardVector,upVector;

@property (assign)		CGRect		viewPort;

@property (assign)		Renderer	*renderer;

@property (assign)		Vector3		globalUpVector;


-(id) init;
-(id) initWithPerspectiveFov:(float)fov aspectRatio:(float)aspectWdivH zNear:(float)zN zFar:(float)zF;
-(id) initWithOrthoLeft:(float)left Right:(float)right Top:(float)top Bottom:(float)Bottom;

-(void) setFov:(float)_fov;
-(void) setAspectRatio:(float)aspectWdivH;

-(void) setViewPortX:(float)x Y:(float)y W:(float)width H:(float)height;

-(void) setPosX:(float)x Y:(float)y Z:(float)z;

-(void) lookAtPos:(Vector3*)posToLook;
-(void) lookAtPosX:(float)x Y:(float)y Z:(float)z;
-(void) lookAtDir:(Vector3*)lookDir;
-(void) lookAtDirX:(float)x Y:(float)y Z:(float)z;

-(void) getPickRayWithScreenX:(float)sx ScreenY:(float)sy RayOrigin:(Vector3*)rayOrig RayDir:(Vector3*)rayDir; 

@end
